from Po.Base import Base
from selenium.webdriver.common.by import By
import time

class Page(Base):
    # 点击请登录
    login_loc = (By.LINK_TEXT, '请登录')
    # 输入账号
    username_loc = (By.NAME, 'uname')
    # 输入密码
    password_loc = (By.XPATH, '//*[@id="password"]')
    # 点击登录成功
    dl_loc = (By.ID, 'save')
    # 关闭公告
    gb_loc = (By.CLASS_NAME, 'bindSub')

    def login(self):
        self.click(self.login_loc)

    def username(self):
        self.send_keys(self.username_loc,'17601535724')
        # self.find_element(self.username_loc).send_keys(username)

    def password(self):
        self.send_keys(self.password_loc,'123456Aa')
        # self.find_element(self.username_loc).send_keys(password)

    def dl(self):
        self.click(self.dl_loc)

    def gb(self):
        self.click(self.gb_loc)

    def jiuxian_luoji1(self):
        self.open_url('https://www.jiuxian.com/')
        self.login()
        self.username()
        self.password()
        time.sleep(10)
        self.dl()
        self.gb()
